package game.Menus;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.geom.Vector2f;

import game.ActionListener;
import game.Config.Config;

/**
 * This class represents the menuItems used in the advanced menu item. 
 * @author Sebastian Isheden and Victor Beer
 *
 */
public class AdvancedMenuItem extends MenuItem{
	private Image image;
	private Vector2f position;
	
	/**
	 * Creates a new menu item
	 * @param image THe image.
	 * @param position The position of the menu item.
	 * @param action THe action the menu item will perform when pushed.
	 */
	public AdvancedMenuItem(Image image, Vector2f position, ActionListener action) {
		super(action);
		this.image = image;
		this.position = position.copy();
	}

	@Override
	/**
	 * Prints the menu item to the screen.
	 */
	public void print(Graphics graphic, Vector2f position, boolean selected) {
		if(selected){
			image.draw(position.x, position.y, Config.SELECTED_IMAGE_SCALE);
		}else{
			image.draw(position.x,position.y);
		}
	}
	
	/**
	 * Returns the width of the image
	 * @return The width of the image.
	 */
	public int getImageWidth() {
		return this.image.getWidth();
	}
	
	/**
	 * @return Returns the position of the menu item.
	 */
	public Vector2f getPosition() {
		return this.position.copy();
	}
	
	/**
	 * @param position The offset 
	 */
	public void print(Vector2f offset) {
		this.image.draw(offset.x + this.position.x,offset.y + this.position.y);
	}

}